/*
 * Created by SharpDevelop.
 * User: Songwut Khamsuk
 * Date: 15/6/2552
 * Time: 14:29
 * 
 * To change this template use Tools | Options | Coding | Edit Standard Headers.
 */
using ICSharpCode.Core;
using System.Resources;

namespace DreamShieldBinding
{
	/// <summary>
	/// Description of RegisterResourcesCommand.
	/// </summary>
	public class RegisterResourcesCommand : AbstractCommand
	{
		static bool _isRegistered = false;
		
		/// <summary>
		/// Starts the command
		/// </summary>
		public override void Run()
		{
		    if (_isRegistered) return;
		    _isRegistered = true;
		    
		    ResourceService.RegisterNeutralStrings(new ResourceManager("DreamShieldBinding.Resources.StringResources", GetType().Assembly));
			ResourceService.RegisterNeutralImages(new ResourceManager("DreamShieldBinding.Resources.BitmapResources", GetType().Assembly));
			
			AddInTreeNode node = AddInTree.GetTreeNode("/Workspace/Parser");
			foreach(Codon codon in node.Codons)
			{
				if(codon.Id == "XmlFoldingParser")
				{
					string p = (string)codon.Properties.Get("supportedextensions");
					codon.Properties.Set("supportedextensions", p + ";.dscx");
				}
			}
		}
	}
}
